package com.executor.gateway.service;

import reactor.core.publisher.Mono;
import java.time.LocalDateTime;

/**
 * 指标服务接口
 * 提供API调用指标的收集和查询功能
 * 
 * @author miaoguoxin
 * @date 2024/01/01
 */
public interface MetricsService {

    Mono<Void> incOneCount2MetricsMap(String uri,String countParam);

    Mono<Void> save2Db();
    
    /**
     * 记录请求指标
     */
    Mono<Void> recordRequest(String serviceId, String method, String path, String clientIp, String userAgent, LocalDateTime timestamp);
    
    /**
     * 记录响应指标
     */
    Mono<Void> recordResponse(String serviceId, int statusCode, long responseTime, LocalDateTime timestamp);
    
    /**
     * 记录错误指标
     */
    Mono<Void> recordError(String serviceId, String errorType, String errorMessage, LocalDateTime timestamp);
    
    /**
     * 增加API计数器
     */
    Mono<Void> incrementApiCounter(String apiPath, String counterType);
    
    /**
     * 记录API响应时间
     */
    Mono<Void> recordApiResponseTime(String apiPath, long responseTime);
    
    /**
     * 更新服务状态
     */
    Mono<Void> updateServiceStatus(String serviceId, LocalDateTime timestamp);
    
    /**
     * 获取API统计信息
     */
    Mono<Object> getApiStatistics(String apiPath, LocalDateTime startTime, LocalDateTime endTime);
    
    /**
     * 获取服务统计信息
     */
    Mono<Object> getServiceStatistics(String serviceId, LocalDateTime startTime, LocalDateTime endTime);
}
